/*
 * Copyright Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@use "sass:color";
@import "variables";
@import "go-variables";
@import "mixins";
@import "notifications";
@import "header";

$auth-config-plugin-icon-size: 30px;
$auth-config-icon-text-padding: 20px;

%boxshadow {
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 20%);
}

%box-shadow {
  box-shadow: 0 3px 11px 0 rgba(0, 0, 0, 15%);
}

.button {
  border: 0;
  font-weight: 600;
}

.container {
  overflow: hidden;
  background: #fff;
  padding: 0;
  margin: 0 15px;
}

.row.expanded {
  max-width: 100%;
  padding: 0 15px;
}

.key-value {
  label {
    display: inline-block;
    min-width: 60px;
    position: relative;

    &::after {
      content: ":";
      position: absolute;
      right: 10px;
    }
  }
}

.add-button {
  @include icon-before($type: plus-circle);
}

.delete-button {
  @include icon-before($type: trash-can, $color: $white, $margin: 0 5px 0 0, $progress-spinner: true);
}

.app-footer {
  .row.expanded {
    padding: 0;
  }
}

// sticky footer

$app-footer-height: 76px;

* {
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  background: $page-body-background;
}

.page-wrap {
  min-height: 100%;
  margin-bottom: -$app-footer-height;

  &::before {
    content: "";
    display: block;
    height: 41px;
  }
}

.page-wrap::after {
  content: "";
  display: block;
}

.app-footer,
.page-wrap::after {
  height: $app-footer-height;
}

// page header

.header-panel {
  position: fixed;
  top: $main-nav-height;
  width: 100%;
  z-index: $header-panel-z-index;

  .message {
    background-color: $body-background;
  }
}

.page-header {
  background: $page-header-bg;
  padding: 10px 15px;
  margin-bottom: 15px;
  position: relative;
  min-height: 50px;
  box-sizing: border-box;
  box-shadow: 0 0 10px rgba(0, 0, 0, 21%);

  h1 {
    display: inline-block;
    color: #333;
    margin: 0;
    padding: 0;
    font-size: 18px;
    line-height: 24px;
    font-weight: 400;
  }
}

.sub-tab-navigation {
  background: $tab-header-bg;
  border-radius: 3px 3px 0 0;
  list-style: none;
  padding: 10px 20px 0;
  margin: 0 30px;

  li {
    border-radius: 3px 3px 0 0;
    display: inline-block;
    background: $tab-bg;
    font-size: 0.8125rem;
    font-weight: 600;

    &:hover {
      background: $tab-header-bg-hover;
    }

    &.current,
    &.current:hover {
      background: $current-tab-bg;
      box-shadow: 0 -1px 2px 1px rgba(0, 0, 0, 10%);
    }
  }

  a {
    display: inline-block;
    padding: 7px 15px;
    line-height: 19px;
    color: #000;
  }
}

.sub-tab-content {
  padding: 15px 20px;
  background: #fff;
  margin: 0 30px;
}

.page-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 16px solid #f3f3f3;
  border-top: 16px solid #963fb7;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  margin: -50px 0 0 -50px;
  animation: spin 2s linear infinite;

  &.small {
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border-width: 8px;
  }
}

[type="text"],
[type="password"],
[type="date"],
[type="datetime"],
[type="datetime-local"],
[type="month"],
[type="week"],
[type="email"],
[type="number"],
[type="search"],
[type="tel"],
[type="time"],
[type="url"],
[type="color"],
textarea {
  transition: all 0.3s ease-in-out;
  padding: 0 0.5rem;

  &:focus {
    background-color: rgba(182, 111, 194, 14%);
    box-shadow: none;
    border-color: $border-color;
    transition: all 0.3s ease-in-out;
  }
}

.main-container {
  margin-top: 70px;
  overflow: auto;
}

// new styles

.key-value-pair {
  margin: 0;
  padding: 0;

  @include clearfix;

  dt, .key {
    float: left;
    min-width: 150px;
    clear: left;
    font-weight: 400;
    margin-bottom: 0;
    font-size: rem-calc(13px);
  }

  dd, .value {
    float: left;
    position: relative;
    padding-left: 15px;
    font-weight: 600;
    font-size: rem-calc(13px);

    &::before {
      content: ":";
      position: absolute;
      left: 5px;
      font-weight: 600;
    }
  }

  // extended for header

  &.key-value-pair-header {
    margin-right: 20px;
    line-height: 30px;

    dt, .key {
      min-width: 10px;
    }
  }
}

ul.key-value-pair {
  list-style-type: none;
  margin: 0;
  padding: 0;

  li {
    padding: 5px;
    border-bottom: 1px dashed color.adjust($border-color, $lightness: 10%);

    @include clearfix;

    &:last-child {
      border: 0;
    }
  }
}

.plugin-group-header {
  .btn-group {
    float: right;
  }

  .warning {
    @include icon-before($type: exclamation-triangle, $size: $component-icon-size, $color: #fff702);

    &::before {
      font-size: 20px;
      text-align: center;
      vertical-align: middle;
    }
  }
}

.plugin-config-read-only {
  .key-value-pair {
    .key {
      width: 25%;
      max-width: 200px;
      word-break: break-all;
    }

    .value {
      width: 70%;
      overflow-x: auto;
    }
  }
}

.page-save-in-progress {
  pointer-events: none;
  opacity: 0.3;
}

// silent classes

%title {
  margin: 0 20px 0 0;
  font-weight: 600;
  font-size: 14px;
  line-height: $component-icon-size;
}
